/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#ifndef M_DXTEXTURE_H
#define M_DXTEXTURE_H

#include "texture.h"
#include "comptr.h"

#include "dxheaders.h"

#include <string>

namespace Engine
{
	/**
	*   Abstract class for textures.
	*/
	class DXTexture: public Texture
	{
	public:
		DXTexture(const std::string& name);
		~DXTexture();
		virtual void Load();
		virtual void UnLoad();
		IDirect3DTexture9* GetTexture();
	private:
		ComPtr<IDirect3DTexture9> m_texture;
	};

	/**
	*   Class for creating textures objects.
	*/
	class DXTextureFactory: public TextureFactory
	{
	public:
		DXTextureFactory():m_type("Texture"){}

		/**
		*   Returns the factory type.
		*/
		virtual const std::string& GetType() const {return m_type;}

		/**
		*   Creates a new object.
		*   @param name Name of the object to create
		*   @return	An object created by the factory. The type of the object depends on	the factory.
		*/
		virtual DXTexture* CreateInstance( const std::string& name );

	private:
		std::string m_type;
	};

}

#endif
